package com.guoxin.concurrentcy.chapter12;

public class TreadGroupCreate {

    public static void main(String[] args) throws InterruptedException {
        ThreadGroup threadGroup = new ThreadGroup("TG1");

        Thread thread = new Thread(threadGroup, "T1") {
            @Override
            public void run() {
                System.out.println(getThreadGroup().getName());
                System.out.println(getThreadGroup().getParent());
            }
        };

        thread.start();
        Thread.sleep(1000);
        ThreadGroup threadGroup2 = new ThreadGroup(threadGroup, "TG2");
        System.out.println(threadGroup2.getName());
        System.out.println(threadGroup2.getParent());
    }
}
